Java.perform(function () {
    var StringBuilder = Java.use("java.lang.StringBuilder");

    StringBuilder.toString.implementation = function () {
        var res = this.toString();
        if (res === 'java.lang.StringBuilder.toString(Native Method)'){
            return
        }
        console.log(res);
        //console.log(Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Throwable").$new()));
        return res;
    }

});


 var trace = function printTrace(){
        console.log("****************** printTrace start ***********************");
        var jAndroidLog = Java.use("android.util.Log");
        var jException = Java.use("java.lang.Exception");

        var threadef = Java.use('java.lang.Thread');
        var threadinstance = threadef.$new();
        var stack = threadinstance.currentThread().getStackTrace();
        console.log("Full call stack:");
        for(var i = 0; i < stack.length; ++i){
            console.log(stack[i].toString());
        }
        console.log("****************** printTrace finish ***********************");
    }

trace()
// frida -U -f com.uuedu.examant -l 01_01_hook_StringBulider.js
// frida -UF  -l  01_01_hook_StringBulider.js
// frida -H 127.0.0.1:8877 -l  01_01_hook_StringBulider.js -f com.uuedu.examant